package com.ugoodtech.mdcc.core.model.mapper;

import com.ugoodtech.mdcc.core.model.entity.UserDepartment;
import com.ugoodtech.mdcc.core.model.entity.UserDepartmentExample;
import java.util.List;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface UserDepartmentMapper {
    @SelectProvider(type=UserDepartmentSqlProvider.class, method="countByExample")
    int countByExample(UserDepartmentExample example);

    @DeleteProvider(type=UserDepartmentSqlProvider.class, method="deleteByExample")
    int deleteByExample(UserDepartmentExample example);

    @Insert({
        "insert into user_department (profile_id, department_id)",
        "values (#{profileId,jdbcType=BIGINT}, #{departmentId,jdbcType=BIGINT})"
    })
    int insert(UserDepartment record);

    @InsertProvider(type=UserDepartmentSqlProvider.class, method="insertSelective")
    int insertSelective(UserDepartment record);

    @SelectProvider(type=UserDepartmentSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="profile_id", property="profileId", jdbcType=JdbcType.BIGINT),
        @Result(column="department_id", property="departmentId", jdbcType=JdbcType.BIGINT)
    })
    List<UserDepartment> selectByExample(UserDepartmentExample example);

    @UpdateProvider(type=UserDepartmentSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") UserDepartment record, @Param("example") UserDepartmentExample example);

    @UpdateProvider(type=UserDepartmentSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") UserDepartment record, @Param("example") UserDepartmentExample example);
}